package com.bw.unit3.viewmodel

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.bw.unit3.base.BaseBean
import com.bw.unit3.base.BaseViewModel
import com.bw.unit3.bean.BannerBean
import com.bw.unit3.bean.CartBean
import com.bw.unit3.bean.GoodsBean
import com.bw.unit3.bean.GoodsDetailBean
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext

/**
 *
 * @ClassName: HomeViewModel
 * @Description: java类作用描述
 * @Author: zhangyanchao
 * @CreateDate: 2024/9/19 4:49 PM
 * @Version: 1.0
 */
class CartViewModel : BaseViewModel() {

    val liveDataCarts = MutableLiveData<BaseBean<List<CartBean>>>()


    //
    fun getCarts() {
        viewModelScope.launch(Dispatchers.IO) {
            liveDataCarts.postValue(apiService.getCarts())
        }

    }


}